<ui:composition xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:c="http://java.sun.com/jstl/core"
     xmlns:fmt="http://java.sun.com/jstl/fmt"
     xmlns:x="http://java.sun.com/jstl/xml"
     xmlns:fn="http://java.sun.com/jstl/functions"
     xmlns:a4j="http://richfaces.org/a4j"
     xmlns:rich="http://richfaces.org/rich"
     xmlns:gape="http://componentes.gape/component/gape">

	<rich:modalPanel id="panelNewItem" autosized="true" headerClass="headerModal">
		<f:facet name="controls">
           <h:panelGroup>
               <h:graphicImage value="/files/close.png" styleClass="hidelink" id="hidelinkPanel"/>
               <rich:componentControl for="panelNewItem" attachTo="hidelinkPanel" operation="hide" event="onclick"/>
           </h:panelGroup>
       	</f:facet>		
		<f:facet name="header">
			<h:outputText value="#{swot.headerPanelNewItem}" />
		</f:facet>
		<a4j:form>
			<h:panelGrid columns="2" footerClass="FormLinhaBotoes" columnClasses="label,field">
				<h:outputText value="#{msg.nameLabel}"/>
				<h:inputText value="#{swot.newItemName}" />
				
				<h:outputText value="#{msg.relevanceLabel}"/>
				<h:selectOneMenu value="#{swot.relevanceNewItem}">
					<f:selectItem itemLabel="#{msg.relevanceLow}" itemValue="#{1}"/>
					<f:selectItem itemLabel="#{msg.relevanceMedium}" itemValue="#{2}"/>
					<f:selectItem itemLabel="#{msg.relevanceHigh}" itemValue="#{3}"/>
				</h:selectOneMenu>
			</h:panelGrid>
				
			<h:panelGrid columns="1" footerClass="FormLinhaBotoes">
				<rich:listShuttle sourceValue="#{swot.listaPerspectives}" targetValue="#{swot.listaUsedPerspectives}" 
								  sourceListWidth="140" targetListWidth="140" showButtonLabels="false" id="perspectivesTable" var="row"
								  sourceCaptionLabel="#{msg.existPerspectiveTitle}" targetCaptionLabel="#{msg.usedPerspectiveTitle}">
					<rich:column>
						<h:outputText value="#{swot.mapaPerspectives[row].perspective}" />
					</rich:column>
				</rich:listShuttle>
				
				<f:facet name="footer">
					<h:panelGroup>
						<a4j:commandButton action="#{swot.saveNewItem}" value="#{msg.buttonInsert}" reRender="strengthTable, weaknessTable, opportunityTable, threatTable"
						   				   oncomplete="javascript:Richfaces.hideModalPanel('panelNewItem');" />
						<a4j:commandButton action="#" value="#{msg.buttonCancel}" oncomplete="javascript:Richfaces.hideModalPanel('panelNewItem');"/>
					</h:panelGroup>
				</f:facet>
			</h:panelGrid>
		</a4j:form>
	</rich:modalPanel>

</ui:composition>